//
//  ExamPointCell.m
//  JW_BasePorject
//
//  Created by JW on 2018/7/6.
//  Copyright © 2018年 JW. All rights reserved.
//

#import "ExamPointCell.h"
#import <TTGTextTagCollectionView.h>

@interface ExamPointCell ()

@property (nonatomic,strong)UIView *smallView;

@property (nonatomic,strong)UILabel *titleLabel;


@end

@implementation ExamPointCell


- (void)addChildViews{
    [self.contentView addSubview:self.smallView];
    [self.contentView addSubview:self.titleLabel];
    
    TTGTextTagConfig *config = [[TTGTextTagConfig alloc] init];
    config.tagBackgroundColor = [UIColor whiteColor];
    config.tagBorderColor = [UIColor lightGrayColor];
    config.tagTextColor = [UIColor lightGrayColor];
    
    TTGTextTagCollectionView *tagCollectionView = [[TTGTextTagCollectionView alloc] initWithFrame:CGRectMake(20, 20, SCREEN_WIDTH - 40, 200)];// WithFrame:CGRectMake(20, 20, SCREEN_WIDTH - 40, 200)
    tagCollectionView.backgroundColor = [UIColor redColor];
    tagCollectionView.enableTagSelection = NO;
    tagCollectionView.defaultConfig = config;
    [self.contentView addSubview:tagCollectionView];
    NSLog(@"1-%@",NSStringFromCGSize(tagCollectionView.contentSize));
    
}


#pragma mark - property

- (UILabel *)titleLabel{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 5, 100, 20)];
        _titleLabel.text = @"相关考点";
    }
    return _titleLabel;
}

- (UIView *)smallView{
    if (_smallView == nil) {
        _smallView = [[UIView alloc] initWithFrame:CGRectMake(10, 5, 5, 20)];
        _smallView.backgroundColor = ZhuTiColor;
    }
    return _smallView;
}


#pragma mark - cell

+ (ExamPointCell *)cellWithTableView:(UITableView *)tableView{
    static NSString *ident = @"ExamPointCell";
    
    ExamPointCell *cell = [tableView dequeueReusableCellWithIdentifier:ident];
    if (!cell) {
        cell = [[ExamPointCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ident];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addChildViews];
    }
    return  self;
}


@end
